﻿<!--suppress ALL -->
<include file="./Template/header.html" />


<link rel="stylesheet" type="text/css" href="/Template/css/checkin.css?v=8">
<link rel="stylesheet" type="text/css" href="/Template/css/button.css?v=4">
<script type="text/javascript">



    $(function() {
        //初始化页面配置
        if('{$type}' == 'all'){
            initPage("支具穿戴计时工具");
        }else{
            initPage("马蹄足专区");
        }

        var app = new Vue({
            el: '#container',
            data: {
                finishedProductList: [],
            },
            methods: {
                checkRole: function(employeeRoleId, roleId) {
                    var employeeRoleArr = employeeRoleId.split(",");
                    var roleArr = roleId.split(",");

                    var result = false;
                    $.each(roleArr, function(i,val){
                        if($.inArray(val, employeeRoleArr) != -1 || $.inArray((parseInt(val)+100).toString(), employeeRoleArr) != -1){
                            result = true;
                        }
                    });
                    return result;
                },
                link: function(id) {
                    if(id == 1){
                        window.location.href = "/wechat/clubfoot/myIcoin";
                    }
                    if(id == 2){
                        window.location.href = "/wechat/clubfoot/faq?type=iowa";
                    }
                    if(id == 3){
                        window.location.href = "/wechat/clubfoot/checkin?type={$type}";
                    }
                },
                chart: function() {
                    if("{$customer.valid}" == -1){
                        if(!confirm("访问[穿戴记录]需要先完善个人资料，是否跳转到[个人资料]页面？")){
                            return false;
                        }else{
                            window.location.href = "/wechat/userCenter/myInfo";
                        }
                    }else{
                        window.location.href = "/wechat/clubfoot/chart?type={$type}";
                    }
                },
                updateInfo: function() {
                    window.location.href = "/wechat/userCenter/myInfo";
                },
                dailyCheckin: function() {
                    $.ajax({
                        url: "/wechat/clubfoot/dailyCheckin",
                        type: "post",
                        data: {},
                        dataType: "JSON",
                        beforeSend: function () {
                            $("#loadingToast").show();
                        },
                        complete: function () {
                            $('#loadingToast').hide();
                        },
                        success: function (data) {
                            if (data.code == 100) {
                                alert("穿戴开始");
                                window.location.href = "/wechat/clubfoot/checkin?type={$type}";
                            }
                            if (data.code == 200) {
                                alert("穿戴结束");
                                window.location.href = "/wechat/clubfoot/checkin?type={$type}";
                            }
                        },
                    })
                },
                iowaOrder: function() {
                    window.location.href = "/wechat/finishedProduct/finishedOrder/id/1";
                },
                ponsetiOrder: function() {
                    window.location.href = "/wechat/clubfoot/ponseti";
                },
                order: function(id) {
                    window.location.href = "/wechat/order/index/id/"+id;
                },
                guarantee: function() {
                    window.location.href = "/wechat/clubfoot/guarantee";
                },
                orderList: function() {
                    window.location.href = "/wechat/finishedProduct/orderList";
                },
                customerService: function () {
                    $(".subscribe").show();
                },
                message: function() {
                    window.location.href = "/wechat/Messagebox/clubfoot";
                },
                closeCustomerService: function () {
                    $(".subscribe").hide();
                }
            }
        })
        function freshCheckin() {
            $.ajax({
                url: "/wechat/clubfoot/freshCheckin",
                type: "post",
                data: {},
                dataType: "JSON",
                beforeSend: function () {
                    $("#loadingToast").show();
                },
                complete: function () {
                    $('#loadingToast').hide();
                },
                success: function (data) {
                    if (data.code == 200) {
                        alert("上次打卡未关闭");
                        window.location.href = "/wechat/clubfoot/checkin?type={$type}";
                    }
                },
            })
        }
        function getClubfootProductList(classId, keyword) {

            $.ajax({
                url:"/wechat/clubfoot/clubfootProductList",
                type:"post",
                data:{
                    classId: classId,
                    keyword: keyword
                },
                dataType:"JSON",
                beforeSend:function(){
                    $("#loadingToast").show();
                },
                complete:function(){
                    $('#loadingToast').hide();
                },
                success:function(data){
                    app.finishedProductList = data;
                    setTimeout(function() {
                        $(".ui-item.measure-info img").bind("click", function() {
                            var upUrl = "/Template/images/icon-up.png";
                            var downUrl = "/Template/images/icon-down.png";
                            $(this).parent().next().toggle();
                            if($(this).attr("src") == upUrl) {
                                $(this).attr("src", downUrl);
                            } else {
                                $(this).attr("src", upUrl);
                            }
                        });
                        $(".ui-item.measure-info img").each(function() {
                            $(this).trigger("click");
                        });
                    },200);
                },
            })
        }
//        getClubfootProductList("{$classId}","{$keyword}");
//        $(".search-box").change(function() {
//            var value = $(this).find("option:selected").text();
//            $(this).prev().attr('placeholder',value);
//        });
//
//
//        $("select[name=classId]").change(function() {
//
//            var classId = $(this).val();
//            var keyword = $("input[name=keyword]").val();
//            getClubfootProductList(classId,keyword);
//
//        });
//
//        $("input[name=keyword]").change(function() {
//            var classId = $("select[name=classId]").val();
//            var keyword = $(this).val();
//            getClubfootProductList(classId, keyword);
//
//        });
//
//        $("img[name=searchImg]").click(function() {
//
//            var classId = $("select[name=classId]").val();
//            var keyword = $("input[name=keyword]").val();
//            getClubfootProductList(classId, keyword);
//
//        });
        $("select[name=chartId]").change(function() {
            window.location.href = "/wechat/clubfoot/chart/id/"+$(this).val();
        });
//        freshCheckin();
    });


</script>
<div class="container" id="container" style="background-color: #ffffff">
    <div class = "search">
        <div class="class-search">
            <div>
                <span class="class-start">上次开始时间：</span><span class="class-time">{$info.checkin_time}</span>
            </div>
            <div>
                <span class="class-duration">今日穿戴时长：</span><span class="class-time">{$info.duration}</span>
            </div>
            <div>
                <button class="info-button" v-on:click="chart()">穿戴记录</button>
                <if condition="$info['checkin_type'] eq '0'">
                    <button class="info-start-button" v-on:click="dailyCheckin()">开始穿戴</button>
                </if>
                <if condition="$info['checkin_type'] eq '1'">
                    <button class="info-stop-button" v-on:click="dailyCheckin()">停止穿戴</button>
                </if>
            </div>
        </div>
    </div>

    <if condition="$type eq 'all'">
        <div class="qiandao-bottom">
            <div class="qiandao-rule-list">
                <p>·为患者穿戴好支具点击绿色‘开始穿戴’按钮</p>
                <p>·为患者脱下支具时点击红色‘停止穿戴’按钮</p>
                <p>·开始与停止按钮将自动切换‘穿戴时间’累计</p>
            </div>

        </div>
    </if>

    <if condition="$type neq 'all'">
        <div class="qiandao-bottom">
            <div class="qiandao-rule-list">
                <!--h4>穿戴打卡规则介绍：</h4-->
                <p>·为宝宝穿戴好支具点击绿色‘开始穿戴’按钮</p>
                <p>·为宝宝脱下支具时点击红色‘停止穿戴’按钮</p>
                <p>·开始与停止按钮将自动切换‘穿戴时间’累计</p>
                <!--p>·按钮自动切换，每日可多次开始和停止，时间将累计</p>
                <p>·若穿戴时间跨越零点，穿戴时间将分别累计到前后两天</p>
                <p>·每日穿戴时间最大为24小时，低于12小时视为无效数据</p-->
            </div>
            <!--div class="qiandao-rule-list">
                <h4>其他规则：</h4>
                <p>1. 首次完善个人资料，并填写实际信息将获得50个I币奖励。</p>
                <p>2. 推荐好友加入“马蹄足交流答疑群”并且该好友成功购买IOWA支具后，推荐者将获得200个I币奖励。</p>
                <p>3. 在“马蹄足交流答疑群”中热心帮助其他病友解决问题并且得到专家认可，每月将获得50个<img class="qiandao-coin" src="/Template/images/icon-icoin.png">币奖励。</p>
                <p>3. 获得的奖励不能直接提现，只能在购买IOWA支具或配件是使用，在消费时1个I币可以抵1元现金使用。</p>
            </div-->
        </div>


        <div class="user-center-exihibate">
            <ul>
                <li class="item" v-on:click="order(2)">
                    <img class="pic" src="/Template/images/icon-buy.png" alt="">
                    <p class="aims">支具购买</p>
                </li>
                <li class="item" v-on:click="link(2)">
                    <img class="pic" src="/Template/images/icon-solution.png" alt="">
                    <p class="aims">相关帮助</p>
                </li>
                <li class="item" v-on:click="link(1)">
                    <img class="pic" src="/Template/images/icon-myCoin.png" alt="">
                    <p class="aims">我的I币</p>
                </li>
                <li class="item" v-on:click="guarantee()">
                    <img class="pic" src="/Template/images/icon-guarantee.png" alt="">
                    <p class="aims">支具保修</p>
                </li>
                <li class="item" v-on:click="ponsetiOrder()">
                    <img class="pic" src="/Template/images/icon-buyModel.png" alt="">
                    <p class="aims">购买模型</p>
                </li>
            </ul>
            <div class="line"></div>
        </div>

        <php>
            if(in_role($employeeRole,"1,2,3,4,5,6,7,8,9,10")){
            $checkRole = 1;
            }else{
            $checkRole = 0;
            }
        </php>
        <div v-if="{$checkRole} == 1 && '{$employee.enterprise_code}' == 'xWk202003270001'">
            <div style="padding-left: 1rem;padding-top: 0.5rem">
                <img style="vertical-align: middle" src="/Template/images/icon-lefthint.png" alt="">
                <span style="color: #5d5e63;">员工与合作伙伴通道</span>
            </div>
            <div style="padding-top: 0" class="user-center-exihibate">
                <ul>
                    <li class="item" v-on:click="iowaOrder()">
                        <img class="pic" src="/Template/images/icon-agent.png" alt="">
                        <p class="aims">渠道下单</p>
                    </li>
                </ul>
                <div class="line"></div>
            </div>
        </div>
        <div v-if="checkRole('{$role}', '1')">
            <div class="chart-info">
                <div class="item">
                    <span>查看用户打卡情况：</span>
                    <input id="chartId" type="text" value="" readonly placeholder="请选择用户">
                    <select name="chartId">
                        <option value="">请选择</option>
                        {:getChartSelectOptionHtml(0,0)}
                    </select>
                    <img class="icon-right" src="/Template/images/icon-right.png" alt="">
                </div>
            </div>
        </div>

        <div v-on:click="message()">
            <div id="message" class="message">
                <img class="message-pic-back" src="/Template/images/icon-message-back.png" alt="">
            </div>
            <div id="message" class="message">
                <img class="message-pic" src="/Template/images/icon-message.png" alt="">
            </div>
        </div>
        <div class="subscribe" style="display: none">
            <div class="two-d-code">
                <img class="two-d-code-bg" src="/Template/images/doc-2d-code-bg.png" alt="">
                <img class="two-d-code-img" src="/Template/images/customer-service-qrcode.png" alt="">
                <p class="recognize">
                    <br/>
                    长按图片[识别二维码]添加客服微信
                    <br/>
                    <button v-on:click="closeCustomerService()">关闭</button>
                </p>

            </div>
        </div>
    </if>
</div>



    <!--div class="content-left">
        <div class="bg-img" v-on:click="order(2)">
            <img src="/Template/images/orderIowa.png" alt="">
        </div>
    </div>
    <div class="content-right">
        <div class="bg-img" v-on:click="guarantee()">
            <img src="/Template/images/guarantee.png" alt="">
        </div>
    </div>
    <div class="content-left">
        <div class="bg-img" v-on:click="link(1)">
            <img src="/Template/images/myicoin.png" alt="">
        </div>
    </div>
    <div class="content-right">
        <div class="bg-img" v-on:click="link(2)">
            <img src="/Template/images/faq.png" alt="">
        </div>
    </div>
    <div>
        <button class="bottom-button"></button>
    </div>
    <div class="chart-info" v-on:click="ponsetiOrder()">
        <div class="item">
            <span>购买潘塞缇方法相关模型</span>
            <img class="icon-right" src="/Template/images/icon-right.png" alt="">
        </div>
    </div>
    <if condition="$agentId[0] gt 0" >
        <div class="chart-info" v-on:click="iowaOrder()">
            <div class="item">
                <span>iowa支具快速下单</span>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
        </div>

    </if>

    <div v-if="checkRole('{$role}', '1')">
        <div class="chart-info">
            <div class="item">
                <span>查看用户打卡情况：</span>
                <input id="chartId" type="text" value="" readonly placeholder="请选择用户">
                <select name="chartId">
                    <option value="">请选择</option>
                    {:getChartSelectOptionHtml(0,0)}
                </select>
                <img class="icon-right" src="/Template/images/icon-right.png" alt="">
            </div>
        </div>
    </div-->



<include file="./Template/footer.html" />

